package singletonDemo;

public class Singleton2 {
    /**
     * 单例模式
     * 静态内部类
     * 线程安全，且避免了同步带来的性能影响
     */

    private Singleton2(){}
    private static class InnerClassDemo{
        private static final Singleton2 INSTANCE = new Singleton2();
    }

    public static Singleton2 getInstance(){
        return InnerClassDemo.INSTANCE;
    }

}
